package main
import "fmt"



func main() {
	test1()
	//test2()
}

// 二维数组的遍历
func test2() {
	// 定义二维数组并初始赋值
	var arr1 = [3][2]int{
		{1, 2},
		{3, 4},
		{5, 6},
	}
	fmt.Println(arr1)

	// 普通for循环
	for i := 0; i < len(arr1); i++ {
		for j := 0; j < len(arr1[i]); j++ {
			fmt.Print(arr1[i][j] ,"\t")
		}
		fmt.Println()
	}

	fmt.Println("-------------")
	// for range循环
	for _, v := range arr1 {
		for _, v1 := range v {
			fmt.Print(v1,"\t")
		}
		fmt.Println()
	}

}

func test1() {
	// 定义二维数组
	var arr [3][2]int
	fmt.Println(arr)

	// 定义二维数组并初始赋值
	var arr1 = [3][2]int{
		{1, 2},
		{3, 4},
		{5, 6},
	}
	fmt.Println(arr1)

	var arr2 = [...][2]int{
		{1, 2},
		{3, 4},
		{5, 6},
	}
	fmt.Println(arr2)

	// 以下操作是有问题的
	/*
	var arr3 = [2][...]int{
		{1, 2},
		{3, 4},
	}
	fmt.Println(arr3)
	*/
}